package controller;

import UI.EditorsUI;
import UI.MenuUI;
import controller.Menu.IMenuEditController;
import controller.Menu.IMenuFileController;
import controller.Menu.MenuFileController;
/**
 * @date Apr. 16, 2012
 * @author Francisco J. Martínez
 *	This is a controller for the menu bar allowing to separate functionality
 * for others views and objects.
 */
public class MenuController implements IMenuController{

	private IMainController mainController;

	private IMenuFileController mFile;
	private IMenuEditController mEdit;
	
	private MenuUI mView;
	
	// Constructor
	public MenuController(IMainController topController){
		this.mainController = topController;
		this.mFile = new MenuFileController(this);
	}
	
	@Override
	public void loadTextIntoTextEditor(String text) {
		mainController.loadTextIntoTextEditor(text);
	}

	@Override
	public String getTextOfTheBasicEditor() {
		return mainController.getTextOfTheBasicEditor();
	}
	
	@Override
	public void setView(MenuUI mView) {
		this.mView = mView;
		this.mView.setController(this);
		this.assingViewsToControllers();
	}
	
	private void assingViewsToControllers(){
		this.mFile.setView(mView.getMenuFile());
		// Poner los otros cuando esten listos
	}

}
